Using Geometric Shapes
This section shows you how to create, edit, and draw geometric shapes. In particular, this section shows you how to
All of the sample functions in this section create geometric shapes with default style, ink, and transform information. All shapes are black; framed shapes have one-pixel-wide contours; and the shapes are not rotated, skewed, and so on. For examples of the many stylistic variations you can apply to geometric shapes, see Chapter 3 of this book, "Geometric Styles." For information about inks and transforms, see Inside Macintosh: QuickDraw GX Objects.
- create and draw empty and full shapes
- create point, line, curve, rectangle, polygon, and path shapes
- draw points, lines, curves, rectangles, polygons, and paths
- create framed and solid shapes
- convert a shape from one shape type to another
- replace the geometry of a shape
- replace geometric points within a shape's geometry
- insert geometric points into and remove geometric points from a shape's geometry
Many of the sample functions in this section create geometric shapes and, to do so, they specify geometric points for the shapes' geometries. Since a geometric point contains two fixed-point values (of type
Fixed
), the sample functions in this section must convert integer constants to fixed-point constants when specifying a geometric point. QuickDraw GX provides theGXIntToFixed
macro, which performs this conversion by shifting the integer value 16 bits to the left:
#define GXIntToFixed(a) ((Fixed)(a) << 16)QuickDraw GX also provides theff
macro as a convenient alias:
#define ff(a) GXIntToFixed(a)A few of the sample functions in this section specify fractional values for geometric point coordinates. To convert a floating-point value (of typefloat
) to a fixed-point value (typeFixed
), QuickDraw GX provides theGXFloatToFixed
macro:
#define GXFloatToFixed(a) ((Fixed)((float)(a) * fixed1))and the synonymousfl
macro:
#define fl(a) GXFloatToFixed(a)
- IMPORTANT
- The
GXIntToFixed
macro has substantially faster performance than theGXFloatToFixed
macro. Whenever possible, you should choose theGXIntToFixed
macro over theGXFloatToFixed
macro.![]()
Subtopics
- Creating and Drawing Empty Shapes and Full Shapes
- Creating and Drawing Points
- Creating and Drawing Lines
- Creating and Drawing Curves
- Creating and Drawing Rectangles
- Creating and Drawing Polygons
- Creating and Drawing Paths
- Converting Between Geometric Shape Types
- Replacing Geometric Points
- Editing Polygon Parts
- Editing Paths Parts
- Editing Shape Parts
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help